package com.googlecode.lemyriapode.implementation;

import com.googlecode.lemyriapode.regle.Regle;
import com.googlecode.lemyriapode.type.*;
import com.googlecode.lemyriapode.regle.Position;
import static com.googlecode.lemyriapode.type.Echiquier.Case.*;

/**
 * Iteration sur toutes les directions
 * T,F,D,R,P : 8 directions
 * C : 8 directions
 * @author Gilles
 */
public class FMDirection extends AFPosition {

    public FMDirection(final Regle regle) {
        super();
        this.regle = regle;
    }

    @Override
    public boolean continuer(int n, Position position) {

        Echiquier b = position.echiquier;
        I = b._c.Ci() + n * b.dir.u;
        J = b._c.Rj() + n * b.dir.v;
        return !Echiquier.isOut(I, J);
    }

    @Override
    public void executer(int n, Position position) {
        System.out.print(getCase(I, J) + ",");
    }

    @Override
    public Object stopper(int n, Position position) {
        System.out.print("/");
        return null;
    }
}
